import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
const state = {
  count: 0,
  userid: 0,
  see_find_word_list: [],
  word_detail_id: 0,
  myreview_find_word_list:[],
  myreview_refresh: true
}
const mutations = {
  delete_myreview_word_list(state, start){
    console.debug("store delelte start:"+start)
    state.myreview_find_word_list.splice(start-1, 1)
    // state.myreview_find_word_list.splice(2)
  },
  setMyReview_Refresh_true(state){
    state.myreview_refresh = true
  },
  setMyReview_Refresh_false(state){
    state.myreview_refresh = false
  },
  increment (state) {
    state.count++
  },
  setSeeFindWordList(state, list){
    console.debug("$store 里 设置see_find_word_list成功param:"+JSON.stringify(list+"2121"))
    state.see_find_word_list = list
  },
  setMyReviewFindWordList(state, list){
    console.debug("$store 里 设置myreview_find_word_list成功param:"+JSON.stringify(list+"11111"))
    state.myreview_find_word_list = list
  },
  setWordDetailId(state, wordid){
    state.word_detail_id = wordid
  }
}

const store = new Vuex.Store({
  state,
  mutations,
  getters: {
    inc_inc: function (state) {
      return state.count + 5
    },
    start: function (state) {
      return state.see_find_word_list.length>0?1:0

    },
    end: function (state) {
      let list = state.see_find_word_list
      console.debug("list change:list size="+list.length)
      return list.length
    }
  }
})

export default store
